package com.charles.core.event.listener;


import com.charles.anno.EventBusListener;
import com.charles.core.event.ViewEvent;
import com.charles.entity.ShortUrl;
import com.google.common.eventbus.Subscribe;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * @author charles
 * @date 2022/9/4 15:20
 */
@Component
@Slf4j
@EventBusListener
public class ViewEventListener {

    @Subscribe
    public void viewed(ViewEvent event) {
        ShortUrl shortUrl = event.getShortUrl();
        log.info("url被访问" + shortUrl);
    }
}
